//
//  LYQMineCardCell.m
//  ZCProject
//
//  Created by Zheng on 16/11/14.
//  Copyright © 2016年 Zheng. All rights reserved.
//

#import "LYQMineCardCell.h"

@implementation LYQMineCardCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        UIImage *aImage = [UIImage imageNamed:@"morejticon"];
        UIImageView *aImgv = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, aImage.size.width, aImage.size.height)];
        aImgv.image = aImage;
        self.accessoryView = aImgv;
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self.contentView addSubview:self.userIconImgv];
        [self.contentView addSubview:self.nameLbl];
        [self.contentView addSubview:self.companyLbl];
        
        [self layoutSubviewsInContentView];
    }
    return self;
}

#pragma mark - layout subviews
- (void)layoutSubviewsInContentView {
    
    [_userIconImgv mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kWScale(17));
        make.centerY.equalTo(self);
        make.width.height.equalTo(@(kWScale(64)));
    }];
    
    [_nameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_userIconImgv.mas_right).offset(kWScale(22));
        make.top.equalTo(_userIconImgv).offset(kWScale(10));
    }];
    
    [_companyLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(_nameLbl);
        make.bottom.equalTo(_userIconImgv).offset(-kWScale(10));
    }];
}

#pragma mark - load subviews
- (UIImageView *)userIconImgv {
    if (!_userIconImgv) {
        _userIconImgv = [[UIImageView alloc] init];
        _userIconImgv.backgroundColor = [UIColor orangeColor];
        _userIconImgv.layer.cornerRadius = kWScale(32);
        _userIconImgv.layer.borderColor = [RGB(224, 224, 224, 1) CGColor];
        _userIconImgv.layer.borderWidth = kWScale(3);
    }
    return _userIconImgv;
}

- (UILabel *)nameLbl {
    if (!_nameLbl) {
        _nameLbl = [[UILabel alloc] init];
        _nameLbl.font = kWFont(17);
        _nameLbl.textColor = kLYQBlack;
        _nameLbl.text = @"李均";
    }
    return _nameLbl;
}

- (UILabel *)companyLbl {
    if (!_companyLbl) {
        _companyLbl = [[UILabel alloc] init];
        _companyLbl.font = kWFont(15);
        _companyLbl.textColor = kLYQGray;
        _companyLbl.text = @"博信 ( 北京 ) 会展有限公司";
    }
    return _companyLbl;
}



@end
